package com.hung.triple.protocol.rpc;

import com.hung.triple.protocol.TripleTransportObject;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.commons.lang3.RandomUtils;

/**
 * RPC 请求对象
 *
 * @author Hung
 * @since 2022/9/18
 */
@Setter
@Getter
@ToString
public class TripleRpcRequest implements TripleTransportObject {

    private static final long serialVersionUID = 1L;

    private String group;
    private String version;

    private String className;
    private String methodName;
    private Class<?>[] parameterTypes;
    private Object[] parameters;

    private Integer requestId;
    private TripleRpcContext context;

    /**
     * 0 心跳
     */
    private Integer type;

    public TripleRpcRequest() {
        requestId = RandomUtils.nextInt();
        context = new TripleRpcContext(requestId);
        type = 1;
    }
}
